<div class="formVenue">
    <div class="venue">        
        <?php for ($i = 0; $i < count($allVenues); $i++) { ?>
            <?php $model = $this->loadModel($allVenues[$i]->course_venue_id, 'ClassVenue'); ?>
            <?php $allBatchesWithVenue = $modelCourseBatche->findAllByAttributes(array('course_venue_id' => $allVenues[$i]->course_venue_id, 'courses_id' => $allVenues[$i]->courses_id)); ?>
            <input type="hidden" name="venueIndex[]" id="venueIndex_venue_<?php echo $i; ?>_batch_0_earlydiscount_0" value="<?php echo $i; ?>" class="venueIndex"/> <?php /* This line use for function classVenueIndex means how many genarate venue venue remove the field venue then use this   */ ?>
            <div class="addVenue_venue_<?php echo $i; ?>" id="venue_<?php echo $i; ?>">
                <div class="row">
                    <div class="rowLabel">Select Venue</div>
                    <div class="rowControl">
                        <?php echo CHtml::dropDownList('ClassVenue[venueId][]', $allVenues[$i]->course_venue_id, getVenueByBackendUser($model), array("empty" => "Select venue", 'class' => 'selectbox selectVenue', 'onchange' => 'getVanueDeatils(this.id);', 'id' => 'ClassVenue_venueId_' . $i)); ?>
                        <p id="Error_MSG_ClassVenue_venueId_<?php echo $i; ?>" class="customeClassvalidate" style="display:none">You have already select this venue.so please select another venue!</p>
                    </div>
                </div>
                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'name'); ?> </div>
                    <div class="rowControl"><?php echo $form->textField($model, 'name[]', array('maxlength' => 45, 'class' => 'input-xlarge requiredfield', 'id' => 'ClassVenue_name_' . $i, 'onblur' => 'getChnageinField(this.id)', 'value' => $model->name)); ?>
                    </div>
                </div>

                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'address_line1'); ?> </div>
                    <div class="rowControl"><?php echo $form->textField($model, 'address_line1[]', array('maxlength' => 45, 'class' => 'input-xlarge requiredfield', 'id' => 'ClassVenue_address_line1_' . $i, 'value' => $model->address_line1)); ?>
                    </div>
                </div>

                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'address_line2'); ?></div>
                    <div class="rowControl"><?php echo $form->textField($model, 'address_line2[]', array('maxlength' => 45, 'class' => 'input-xlarge', 'id' => 'ClassVenue_address_line2_' . $i, 'value' => $model->address_line2)); ?>                  
                    </div>
                </div>
                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'venue_locality'); ?>
                    </div>
                    <div class="rowControl"><?php echo $form->textField($model, 'venue_locality[]', array('maxlength' => 145, 'class' => 'input-xlarge', 'id' => 'ClassVenue_venue_locality_' . $i, 'value' => $model->venue_locality, 'onkeyup' => "getLocality(this.id)")); ?>                  
                    <p class="note" style="width: 72%;margin: 0 auto;"> Note:<?php echo Message::LOCALITY_HELP;?></p></div><!-- row -->
                </div>

                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'zip_code'); ?></div>
                    <div class="rowControl"><?php echo $form->textField($model, 'zip_code[]', array('maxlength' => 6, 'class' => 'input-xlarge requiredfield', 'id' => 'ClassVenue_zip_code_' . $i, 'value' => $model->zip_code)); ?>                  
                    </div>
                </div>


                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'country_id'); ?></div>
                    <div class="rowControl">
                        <?php echo CHtml::dropDownList('ClassVenue[country_id][]', $model->country_id, GxHtml::listData(Country::model()->findAllByAttributes(array('is_active' => SkillConfig::STATUS_ACTIVE)), 'id', 'name'), array('class' => 'selectbox requiredfield', 'id' => 'ClassVenue_country_id_' . $i, 'onchange' => 'getStateDependonCountry(this.id);')); ?>
                    </div>
                </div>

                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'state_id'); ?></div>
                    <div class="rowControl">
                        <?php echo CHtml::dropDownList('ClassVenue[state_id][]', $model->state_id, GxHtml::listData(State::model()->findAllByAttributes(array('is_active' => SkillConfig::STATUS_ACTIVE)), 'id', 'name'), array('class' => 'selectbox requiredfield', 'id' => 'ClassVenue_state_id_' . $i, 'onchange' => 'getCityDependonCountry(this.id);')); ?>
                        <?php echo $form->error($model, 'state_id'); ?>
                    </div>
                </div>

                <div class="row">
                    <div class="rowLabel"><?php echo $form->labelEx($model, 'city_id'); ?>  </div>
                    <div class="rowControl">
                        <?php echo CHtml::dropDownList('ClassVenue[city_id][]', $model->city_id, GxHtml::listData(City::model()->findAllByAttributes(array('status' => SkillConfig::STATUS_ACTIVE)), 'id', 'city_name'), array('class' => 'selectbox requiredfield', 'id' => 'ClassVenue_city_id_' . $i)); ?>
                    </div>
                </div>

                <div class="betch" >
                    <?php for ($j = 0; $j < count($allBatchesWithVenue); $j++) { ?>
                        <?php $allEarlyDiscountWithBatche = $modelCourseEarlyDiscount->findAllByAttributes(array('course_batche_id' => $allBatchesWithVenue[$j]->id)); ?>
                        <?php $allGroupDiscountWithBatche = $modelGroupDiscount->findAllByAttributes(array('course_batche_id' => $allBatchesWithVenue[$j]->id)); ?>
                        <?php $allCourseBatcheDaySession = CourseBatcheDaySession::model()->findAllByAttributes(array('course_batche_id' => $allBatchesWithVenue[$j]->id)); ?>
                        <?php $allCourseBatcheDateSession = CourseBatcheDateSession::model()->findAllByAttributes(array('course_batche_id' => $allBatchesWithVenue[$j]->id)); ?>
                        <?php $allCourseStructure = $modelCourseStructures->findAllByAttributes(array('courses_id' => $allVenues[$i]->courses_id, 'course_batche_id' => $allBatchesWithVenue[$j]->id)); ?>




                        <div class="addbatch_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>">
                            <div class="addremovebatch_adds_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_0">
                                <fieldset>
                                    <legend>Batch Detail <a href="javascript:void(0)" id="course_batcheshelp<?php echo $j; ?>" onmouseover="getTolltipId(this.id);" rel="popover" data-content="<?php echo Message::COURSE_BATCHES; ?>" data-original-title="<?php echo Message::SKILL_HELP; ?>"><img src="<?php echo ThemePath(); ?>/img/icons/icon_tooltip.gif"/></a></legend>
                                    <div class="batchClone"> 
                                        <div class="image">
                                            <?php
                                            $this->renderPartial('/courseBatche/_form_update', array('form' => $form,
                                                'model' => $modelCourseBatche, 'allBatchesWithVenue' => $allBatchesWithVenue,
                                                'venueIndex' => $i,
                                                'batcheIndex' => $j,
                                            ));
                                            ?>
                                            <input type="hidden" name="classVenueKey" id="classVenueKey_venue_<?php echo $i; ?>_batch" value="<?php echo $i; ?>"><?php /* This line use for function clasvenuekey means how many genarate venue  */ ?> 
                                            <input type="hidden" name="batcheVenueIndex" id="venueIndex_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0" value="<?php echo $i; ?>" class="venueIndex"/> <?php /* This line use for function classVenueIndex means how many genarate venue venue remove the field venue then use this   */ ?>
                                            <input type="hidden" class="venue_<?php echo $i; ?>_batch0" name="batchIndex[<?php echo $i; ?>][]" id="batchIndex_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0"  value="<?php echo $j; ?>"/>



                                            <?php /* This line use for function batchIndex menas how many genarate batch in this venue  */ ?>  
                                        </div>
                                    </div>

                                    <fieldset>
                                        <legend>Batch Sessions</legend>
                                        <div class="no-of-session-left-div">
                                            <div class="renderbatchFormrowControl">
                                                <div id="addDaySession_venue_<?php echo $i; ?>_batche_<?php echo $j; ?>" <?php if (count($allCourseBatcheDateSession) > 0) { ?>style="display:none;"<?php } else { ?>style="display:block;" <?php } ?>>

                                                    <?php
                                                    if (count($allCourseBatcheDaySession) > 0) {
                                                        for ($day = 0; $day < count($allCourseBatcheDaySession); $day++) {
                                                            $daySessionClass = $allCourseBatcheDaySession[$day]->is_flexible ? '' : ' hasTimepicker requiredfield ';
                                                            $daySessionIs_flexible = $allCourseBatcheDaySession[$day]->is_flexible ? 1 : 0;
                                                            ?>

                                                            <div style="clear: both;margin-top: 10px;">                                                                  
                                                                <div id="batchDaySession_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0_<?php echo $day; ?>">
                                                                    <div class="rowControl courseSession"><?php echo CHtml::dropDownList('CourseBatcheDaySession[CourseBatche][' . $j . '][ClassVenue][' . $i . '][schedule_id][]', $allCourseBatcheDaySession[$day]->schedule_id, getAllSchedule('course'), array('empty' => 'Select Day', 'class' => 'courseselectBox requiredfield ClassDaySession_schedule_id_' . $day, 'id' => 'ClassDaySession_schedule_id_' . $day . '_venue_' . $i . '_batch_' . $j)); ?></div>
                                                                    <div class="rowControl bootstrap-timepicker courseSession"><input class="input-small <?php echo $daySessionClass; ?>" name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][time_from][]" id="ClassDaySession_start_time_<?php echo $day; ?>_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>" type="text"  onpaste="return false;"  onclick="hastimpiker(this.id)" value="<?php echo $allCourseBatcheDaySession[$day]->time_from; ?>" readonly="readonly"><span class="add-on"><i class="icon-time"></i></span></div>
                                                                    <div class="rowControl bootstrap-timepicker courseSession"><input class="input-small <?php echo $daySessionClass; ?>" name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][time_to][]" id="ClassDaySession_end_time_<?php echo $day; ?>_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>" type="text" value="<?php echo $allCourseBatcheDaySession[$day]->time_to; ?>"  onpaste="return false;" onchange="timeCheck(this.id)" onclick="hastimpiker(this.id)" readonly="readonly"><span class="add-on"><i class="icon-time"></i></span></div>
                                                                    <p class="isFlexble"><input type="checkbox" name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][is_flexible][]" value="<?php echo $allCourseBatcheDaySession[$day]->is_flexible; ?>" id="ClassDaySession_is_flexible_<?php echo $day; ?>_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>" onclick="return isFlexibleDaySession(this.id);" <?php if ($allCourseBatcheDaySession[$day]->is_flexible) { ?>checked="checked"<?php } ?>/><p class="isFlexbleLabel">Flexible</p>
                                                                    <input type="hidden" name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][is_flexiblevalue][]" value="<?php echo $daySessionIs_flexible; ?>" id="ClassDaySession_is_flexiblevalue_<?php echo $day; ?>_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>"/>


                                                                    <?php if ($day > 0) { ?>
                                                                        <p class="isFlexbleRemove"><a onclick="removeDaySession(this.id);" id="batchDaySession_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0_<?php echo $day; ?>" class="link-remove"><span>Remove</span></a></p>
                                                                    <?php } ?>
                                                                </div>
                                                                <div class="errorMessage addDayvenueError_<?php echo $day; ?>_venue_<?php echo $i; ?>_batch_<?php echo $j; ?> dateTimeErrormsg"></div>
                                                            </div>
                                                        <?php } ?>

                                                        <div id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0" class="addDayvenue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0"></div>
                                                        <div style="clear: both;margin-top: 10px;"><a class="link-buttonadd" id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0" onclick="addDaySession(this.id,<?php echo $day; ?>);"><span>Add More</span></a></div>														

                                                    <?php } else { ?>
                                                        <!--this is when date session available-->

                                                        <div id="batchDaySession_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0_0">
                                                            <div class="rowControl courseSession"><?php echo CHtml::dropDownList('CourseBatcheDaySession[CourseBatche][' . $j . '][ClassVenue][' . $i . '][schedule_id][]', '', getAllSchedule('course'), array('empty' => 'Select Day', 'class' => 'courseselectBox  ClassDaySession_schedule_id_0', 'id' => 'ClassDaySession_schedule_id_0')); ?></div>
                                                            <div class="rowControl bootstrap-timepicker courseSession"><input class="input-small " name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][time_from][]" id="ClassDaySession_start_time_0_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>" type="text" onpaste="return false;" onclick="hastimpiker(this.id)" placeholder="Start Time" readonly="readonly"><span class="add-on"><i class="icon-time"></i></span></div>
                                                            <div class="rowControl bootstrap-timepicker courseSession"><input class="input-small " name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][time_to][]" id="ClassDaySession_end_time_0_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>" type="text"  onpaste="return false;" onchange="timeCheck(this.id)" onclick="hastimpiker(this.id)" placeholder="End Time" readonly="readonly"><span class="add-on"><i class="icon-time"></i></span></div>
                                                            <div class="rowControl courseSession"><p class="isFlexble"><input type="checkbox" name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][is_flexible][]" value="1" id="ClassDaySession_is_flexible_0_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>" onclick="return isFlexibleDaySession(this.id);"/></P><p class="isFlexbleLabel">Flexible</p></div>
                                                            <input type="hidden" name="CourseBatcheDaySession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][is_flexiblevalue][]" value="0" id="ClassDaySession_is_flexiblevalue_0_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>"/>																

                                                            <div class="errorMessage addDayvenueError_0_venue_<?php echo $i; ?>_batch_<?php echo $j; ?> dateTimeErrormsg"></div>
                                                            <div id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0" class="addDayvenue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0"></div>
                                                        </div>
                                                        <!--this is when date session available-->
                                                        <div style="clear: both;margin-top: 10px;"><a class="link-buttonadd" id="venue_<?php echo $i; ?>_batch_0_earlydiscount_0" onclick="addDaySession(this.id, 0);"><span>Add More</span></a></div>
                                                    <?php } ?>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="no-of-session-right-div">
                                            No. of sessions  <input type="text" name="CourseBatche[ClassVenue][<?php echo $i; ?>][no_of_session][]" id="no_of_session_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>" style="width:50px;" onmouseout="return dateSessionValue(this.value,<?php echo $i; ?>,<?php echo $j; ?>);" onkeyup="return dateSessionValue(this.value,<?php echo $i; ?>,<?php echo $j; ?>);" onkeypress="return isNumberKey(event);" maxlength="2" value="<?php echo count($allCourseBatcheDateSession); ?>" placeholder="0" />				
                                        </div>						

                                        <div id="addDateSession_venue_<?php echo $i; ?>_batche_<?php echo $j; ?>" <?php if (count($allCourseBatcheDateSession) > 0) { ?>style="display: block;"<?php } else { ?>style="display: none;"<?php } ?>>
                                            <div style="clear:both;"></div>
                                            <?php
                                            if (count($allCourseBatcheDateSession) > 0) {
                                                for ($date = 0; $date < count($allCourseBatcheDateSession); $date++) {
                                                    $dateSessionClass = $allCourseBatcheDateSession[$date]->is_flexible ? '' : ' hasTimepicker requiredfield ';
                                                    $dateSessionIs_flexible = $allCourseBatcheDateSession[$date]->is_flexible ? 1 : 0;
                                                    ?> 
                                                    <div class="renderbatchCourse"><div class="rowControl"><input type="text" placeholder="Date" id="ClassDaySession_date_<?php echo $date; ?>_venue_v<?php echo $i; ?>_batch_b<?php echo $j; ?>" name="CourseBatcheDateSession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][date][]" onpaste="return false;"  onclick="hasDatepicker(this.id)" class="input-medium requiredfield" value="<?php echo $allCourseBatcheDateSession[$date]->date; ?>" readonly="readonly"></div>
                                                        <div class="rowControl bootstrap-timepicker CourseBatcheDateSession"><input type="text"  onpaste="return false;" onclick="hastimpiker(this.id)" placeholder="Start Time" id="ClassDaySession_start_time_<?php echo $date; ?>_venue_v<?php echo $i; ?>_batch_b<?php echo $j; ?>" name="CourseBatcheDateSession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][time_from][]" class="input-small <?php echo $dateSessionClass; ?>" value="<?php echo $allCourseBatcheDateSession[$date]->time_from; ?>" readonly="readonly"><span class="add-on"><i class="icon-time"></i></span></div>
                                                        <div class="rowControl bootstrap-timepicker CourseBatcheDateSession"><input type="text" onpaste="return false;" onchange="timeCheck(this.id)"  onclick="hastimpiker(this.id)" placeholder="End Time" id="ClassDaySession_end_time_<?php echo $date; ?>_venue_v<?php echo $i; ?>_batch_b<?php echo $j; ?>" name="CourseBatcheDateSession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][time_to][]" class="input-small <?php echo $dateSessionClass; ?>" value="<?php echo $allCourseBatcheDateSession[$date]->time_to; ?>" readonly="readonly"><span class="add-on"><i class="icon-time"></i></span></div>
                                                        <div class="rowControl"><input id="ClassDaySession_is_flexible_<?php echo $date; ?>_venue_v<?php echo $i; ?>_batch_b<?php echo $j; ?>" name="CourseBatcheDateSession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][is_flexible][]" value="<?php echo $allCourseBatcheDateSession[$date]->is_flexible; ?>" <?php if ($allCourseBatcheDateSession[$date]->is_flexible) { ?>checked="checked" <?php } ?> type="checkbox" onclick="return isFlexibleDateSession(this.id);">&nbsp;Flexible</div><div style="clear:both;"></div><div class="errorMessage addDayvenueError_<?php echo $date; ?>_venue_v<?php echo $i; ?>_batch_b<?php echo $j; ?> dateTimeErrormsg"></div>
                                                        <input type="hidden" name="CourseBatcheDateSession[CourseBatche][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][is_flexiblevalue][]" value="<?php echo $dateSessionIs_flexible; ?>" id="CourseBatcheDateSession_is_flexiblevalue_<?php echo $date; ?>_venue_v<?php echo $i; ?>_batch_b<?php echo $j; ?>"/>														
                                                    </div>
                                                    <?php
                                                }
                                            }
                                            ?>


                                        </div>

                                    </fieldset>

                                    <div class="clear" style="clear: both;margin: 21px;"></div>

                                    <?php for ($e = 0; $e < count($allEarlyDiscountWithBatche); $e++) { ?>

                                        <div id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_<?php echo $e; ?>" class="addEarlyvenue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0">                               
                                            <div id="batchEarlydiscount_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0_<?php echo $e; ?>"><div class="clear"></div><div class="classStructureControl">
                                                    <div class="rowControl"><input type="text" onkeypress="return isNumberKey(event)" placeholder="Discount Price" id="ClassEarlyDiscount_discount_price_0<?php echo $j; ?><?php echo $i; ?>" name="ClassEarlyDiscount[ClassBatch][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][discount_price][]" class="input-medium <?php if ($allEarlyDiscountWithBatche[$e]->discount_price <> "") { ?>requiredfield<?php } ?>" onblur="enableDisableEarlyBirdTextField(this.id);" value="<?php echo $allEarlyDiscountWithBatche[$e]->discount_price; ?>" <?php if ($allEarlyDiscountWithBatche[$e]->discount_price == "") { ?> readonly="readonly" <?php } ?>></div>
                                                    <div class="rowControl"><input type="text" onkeypress="return isNumberKey(event)" placeholder="In Percentage" id="ClassEarlyDiscount_in_percentage_0<?php echo $j; ?><?php echo $i; ?>" name="ClassEarlyDiscount[ClassBatch][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][in_percentage][]" class="input-medium <?php if ($allEarlyDiscountWithBatche[$e]->in_percentage <> "") { ?>requiredfield<?php } ?>" onblur="enableDisableEarlyBirdTextField(this.id);" value="<?php echo $allEarlyDiscountWithBatche[$e]->in_percentage; ?>" <?php if ($allEarlyDiscountWithBatche[$e]->in_percentage == "") { ?> readonly="readonly" <?php } ?>></div>
                                                    <div class="rowControl"> <input type="text" placeholder="Valid To" onpaste="return false;" onclick="hasDatepicker(this.id)" onkeyup="hasDatepicker(this.id)" id="ClassEarlyDiscount_valid_to_0<?php echo $j; ?><?php echo $i; ?>" name="ClassEarlyDiscount[ClassBatch][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][valid_to][]" class="input-medium requiredfield" value="<?php echo $allEarlyDiscountWithBatche[$e]->valid_to; ?>"></div>
                                                    <div class="rowControl"> <a onclick="removeEarlyDiscount(this.id);" id="batchEarlydiscount_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0_<?php echo $e; ?>" class="link-remove"><span>Remove Early Discounts</span></a></div></div></div>
                                        </div>


                                    <?php } ?>

                                    <div id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_<?php echo $e; ?>" class="addEarlyvenue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_<?php echo $e; ?>"></div>
                                    <div style="clear: both;height: 10px;margin-top: 10px;"><a class="link-buttonadd" id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_<?php echo $e; ?>" onclick="updateEarlyDiscount(this.id);"><span>Add Early Discounts</span></a></div>
                                    <hr class="hrclass">
                                    <?php for ($g = 0; $g < count($allGroupDiscountWithBatche); $g++) { ?>      
                                        <div id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_groupdiscount_0" class="addGroupDiscount_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>">

                                            <div id="groupdiscount_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_<?php echo $e; ?>_<?php echo $g; ?>"><div class="clear"></div><div class="classStructureControl">
                                                    <div class="rowControl"><input type="text" onkeypress="return isNumberKey(event)" placeholder="Discount Amount" id="GroupDiscount_discount_amount_0<?php echo $j; ?><?php echo $i; ?>" name="GroupDiscount[ClassBatch][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][discount_amount][]"  class="input-medium <?php if ($allGroupDiscountWithBatche[$g]->discount_amount <> "") { ?>requiredfield<?php } ?>"  onblur="enableDisableGroupDiscountTextField(this.id);"  value="<?php echo $allGroupDiscountWithBatche[$g]->discount_amount; ?>" <?php if ($allGroupDiscountWithBatche[$g]->discount_amount == "") { ?> readonly="readonly" <?php } ?>></div>
                                                    <div class="rowControl"><input type="text" onkeypress="return isNumberKey(event)" placeholder="Discount in percentage" id="GroupDiscountDiscount_in_percentage_0<?php echo $j; ?><?php echo $i; ?>" name="GroupDiscount[ClassBatch][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][discount_in_percentage][]" class="input-medium <?php if ($allGroupDiscountWithBatche[$g]->discount_in_percentage <> "") { ?>requiredfield<?php } ?>" onblur="enableDisableGroupDiscountTextField(this.id);" value="<?php echo $allGroupDiscountWithBatche[$g]->discount_in_percentage; ?>" <?php if ($allGroupDiscountWithBatche[$g]->discount_in_percentage == "") { ?> readonly="readonly" <?php } ?>></div>
                                                    <div class="rowControl"><input type="text" onkeypress="return isNumberKey(event)" placeholder="Group Size" id="GroupDiscount_group_size_0<?php echo $j; ?><?php echo $i; ?>" name="GroupDiscount[ClassBatch][<?php echo $j; ?>][ClassVenue][<?php echo $i; ?>][group_size][]" class="input-medium requiredfield" value="<?php echo $allGroupDiscountWithBatche[$g]->group_size; ?>"></div>
                                                    <div class="rowControl"> <a onclick="removeGroupDiscount(this.id);" id="groupdiscount_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_<?php echo $e; ?>_<?php echo $g; ?>" class="link-remove"><span>Remove Group Discounts</span></a></div></div></div>
                                        </div>
                                    <?php } ?>                                                  

                                    <div id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_groupdiscount_<?php echo $g; ?>" class="addGroupDiscount_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0"></div>

                                    <div style="clear: both;height: 10px;margin:10px 0px 10px 0px;"><a class="link-buttonadd" id="venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_earlydiscount_0" onclick="updateGroupDiscount(this.id);"><span>Add Group Discounts</span></a></div>


                                    <!--Here starting course srtucture per batch-->

                                    <fieldset>	
                                        <legend>Class Structures:</legend>
                                        <div class="image">
                                            <div style="clear:both;"></div>
                                            <?php
                                            $this->renderPartial('/classStructures/_form', array('model' => $modelCourseStructures, 'modelClassCourse' => $modelCourses,
                                                'type' => 'course', 'form' => $form,
                                                'venueIndex' => $i,
                                                'batcheIndex' => $j,
                                                'allCourseStructure' => $allCourseStructure,
                                            ));
                                            ?> 
                                        </div>
                                    </fieldset>





                                    <?php if ($j > 0) { ?>			

                                        <div style="clear: both;height: 10px;margin:28px 0px 10px 0px;">
                                            <a onclick="removeupdateBatch(this.id);" id="addremovebatch_adds_venue_<?php echo $i; ?>_batch_<?php echo $j; ?>_0" class="link-remove"><span>Remove Batch</span></a>
                                        </div>
                                    <?php } ?>								

                                </fieldset>
                            </div>
                        </div>


                    <?php } ?>  


                    <div class="addbatch_venue_<?php echo $i; ?>_batch"></div>
                    <div style="clear: both;height: 10px;margin-top: 10px;"></div>
                    <a class="link-buttonadd" id="venue_<?php echo $i; ?>_batch_<?php echo $j - 1; ?>" onclick="updateBatch(this.id);"><span>Add Batch</span></a>

                </div>
                <?php if ($i > 0): ?><div style="clear: both;height: 10px;margin-top: 20px;"> <a onclick="removeVenue(this.id);" id="venue_<?php echo $i; ?>" class="link-remove"><span>Remove Venue</span></a></div><?php endif; ?>
                <hr class="hrclass">
            </div>
        <?php } ?>      

<!--        <div id="venue_<?php echo $i; ?>" class="addVenue_venue_<?php echo $i; ?>"></div>-->


        <!--<hr class="hrclass">-->
    </div>
    <div style="clear: both;height: 10px;margin-top: 10px;"></div>
    <div id="venue_add"><a class="link-buttonadd" id="add_venue_<?php echo $i - 1; ?>" onclick="updateVenue(this.id);"><span>Add venue</span></a></div>
    <input type="hidden" name="classVenuecountryId" id="classVenuecountryId"><?php /* This line use for function getAllCountry() select all country when genrate javascript form */ ?>  
    <input type="hidden" name="classVenuestateId" id="classVenuestateId"> <?php /* This line use for function getAllSatte() select all state when genrate javascript form */ ?>  
    <input type="hidden" name="classVenuecityId" id="classVenuecityId"><?php /* This line use for function getAllCity select all city when genrate javascript form */ ?>  
    <input type="hidden" name="selectVenuename" id="selectVenuename"> <?php /* This line use for function getVenueName  select all Venue name when genrate javascript form */ ?>   

    <hr class="hr" style="clear:both;background-color: #1d2e7b;height: 2px;">
    <div class="row" style="clear:both;">
        <div class="rowLabel">Other Information
        </div>
        <div class="rowControl"><?php echo $form->textArea($modelCourses, 'course_other_information'); ?>
            <?php echo $form->error($modelCourses, 'course_other_information'); ?>
        </div>
    </div>

    <hr class="hr" style="clear:both;background-color: #1d2e7b;height: 2px;">
    <div class="image">
        <?php $this->renderPartial('/ticketBooked/_form', array('form' => $form, 'model' => $modelTicketBooked, 'modelCourses' => $modelCourses, 'type' => 'course')); ?>
    </div>

</div>
<!-- form -->
<script>
                                function getAllCountry(countryId) {
                                    $("#classVenuecountryId").val(countryId);
                                    $.post("<?php echo Yii::app()->createUrl("classes/getAllCountry"); ?>", {countryId: countryId}, function(result) {
                                        var countryId = $("#classVenuecountryId").val();
                                        $("." + countryId).html(result);
                                    });
                                }
                                function getStateDependonCountry(id) {
                                    var stateId = id.split("_");
                                    $("#classVenuecountryId").val(stateId[3]);
                                    var countryId = $("#" + id).val();
                                    $.post("<?php echo Yii::app()->createUrl("classes/dynamicState"); ?>", {countryId: countryId}, function(result) {
                                        var stateId = $("#classVenuecountryId").val();
                                        $("#ClassVenue_state_id_" + stateId).html(result);
                                    });

                                }
                                function getCityDependonCountry(id) {
                                    var stateId = id.split("_");
                                    $("#classVenuecountryId").val(stateId[3]);
                                    var stateId = $("#" + id).val();
                                    $.post("<?php echo Yii::app()->createUrl("classes/dynamicCity"); ?>", {stateId: stateId}, function(result) {
                                        var cityId = $("#classVenuecountryId").val();
                                        $("#ClassVenue_city_id_" + cityId).html(result);
                                    });
                                }

                                function getVenueName(venueId) {
                                    $("#selectVenuename").val(venueId);
                                    $.post("<?php echo Yii::app()->createUrl("classes/getAllVenue"); ?>", {venueId: venueId}, function(result) {
                                        var venueId = $("#selectVenuename").val();
                                        $("." + venueId).html(result);
                                    });
                                }

                                function getVanueDeatils(id) {
                                    var venueId = id.split("_");
                                    $("#classVenuecountryId").val(venueId[2]);
                                    var venueId = $("#" + id).val();

                                    if (venueId == '') {
                                        var venueId = $("#classVenuecountryId").val();
                                        $("#ClassVenue_name_" + venueId).removeAttr("readonly");
                                        $("#ClassVenue_address_line1_" + venueId).removeAttr("readonly");
                                        $("#ClassVenue_address_line2_" + venueId).removeAttr("readonly");
                                        $("#ClassVenue_zip_code_" + venueId).removeAttr("readonly");
                                        $("#ClassVenue_name_" + venueId).val('');
                                        $("#ClassVenue_address_line1_" + venueId).val('');
                                        $("#ClassVenue_address_line2_" + venueId).val('');
                                        $("#ClassVenue_zip_code_" + venueId).val('');

                                    }
                                    else {
                                        $.post("<?php echo Yii::app()->createUrl("classes/SelectedVenue"); ?>", {venueId: venueId}, function(result) {
                                            var obj = jQuery.parseJSON(result);
                                            var venueId = $("#classVenuecountryId").val();
                                            $("#ClassVenue_name_" + venueId).val('' + obj.name);
                                            $("#ClassVenue_address_line1_" + venueId).val('' + obj.address_line1);
                                            $("#ClassVenue_address_line2_" + venueId).val('' + obj.address_line2);
                                            $("#ClassVenue_zip_code_" + venueId).val('' + obj.zip_code);
                                            $("#ClassVenue_country_id_" + venueId).val('' + obj.country_id);
                                            $("#ClassVenue_state_id_" + venueId).val('' + obj.state_id);
                                            $("#ClassVenue_city_id_" + venueId).val('' + obj.city_id);
                                            $("#ClassVenue_name_" + venueId).attr("readonly", "readonly");
                                            $("#ClassVenue_address_line1_" + venueId).attr("readonly", "readonly");
                                            $("#ClassVenue_address_line2_" + venueId).attr("readonly", "readonly");
                                            $("#ClassVenue_zip_code_" + venueId).attr("readonly", "readonly");

                                        });
                                    }
                                }

                                function getPrimaryImage(id) {
                                    if (confirm("Are you sure for make this primary photo?")) {
                                        var imagename = id;
                                        $.post("<?php echo Yii::app()->createUrl("classes/makePrimaryImage"); ?>", {imagename: imagename}, function(result) {

                                        });
                                    }
                                    return false;

                                }



                                function getAllState(stateId) {
                                    $("#classVenuestateId").val(stateId);
                                    $.post("<?php echo Yii::app()->createUrl("classes/getAllState"); ?>", {stateId: stateId}, function(result) {
                                        var stateId = $("#classVenuestateId").val();
                                        $("." + stateId).html(result);
                                    });
                                }

                                function getAllCity(cityid) {
                                    $("#classVenuecityId").val(cityid);
                                    $.post("<?php echo Yii::app()->createUrl("classes/getAllCity"); ?>", {cityid: cityid}, function(result) {
                                        var cityid = $("#classVenuecityId").val();
                                        $("." + cityid).html(result);
                                    });
                                }





</script>

